<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta charset="UTF-8">
	<title>添加新闻信息</title>
	<meta name="renderer" content="webkit">	
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">	
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">	
	<meta name="apple-mobile-web-app-status-bar-style" content="black">	
	<meta name="apple-mobile-web-app-capable" content="yes">	
	<meta name="format-detection" content="telephone=no">	
	<link rel="stylesheet" type="text/css" href="common/layui/css/layui.css" media="all">
	<link rel="stylesheet" type="text/css" href="common/bootstrap/css/bootstrap.css" media="all">
	<link rel="stylesheet" type="text/css" href="common/global.css" media="all">
	<link rel="stylesheet" type="text/css" href="css/personal.css" media="all">
	<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
	<script  src="common/timelayui/laydate/laydate.js"></script>
</head>
<body class="childrenBody">
	<form class="layui-form">
		<div class="layui-form-item">
			<label class="layui-form-label">新闻标题</label>
			<div class="layui-input-block">
				<input  name="centerName" class="layui-input newsName" lay-verify="required" placeholder="请输入新闻标题" type="text">
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">		
				<label class="layui-form-label">新闻类型</label>
				<div class="layui-input-block">
					<select id="selSex" name="browseLook" class="newsLook" lay-filter="browseLook">
				        
				    </select>
				</div>	
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">新闻类容</label>
			<div class="layui-input-block">
				<textarea name="centerText" class="layui-input newsName" lay-verify="required" placeholder="请输入新闻类容"></textarea>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">		
				<label class="layui-form-label">发布日期</label>
				<div class="layui-input-inline">
					<input class="layui-input newsTime" name="centerTime"  id="test1"   type="text">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-block">
				<span class="layui-btn"  name="qrtj"  lay-filter="addNews">确认添加</span>
				<button type="reset" name="cz" class="layui-btn layui-btn-primary">重置</button>
		    </div>
		</div>
	</form>
	<script type="text/javascript" src="common/layui/layui.js"></script>
	<script type="text/javascript">
	//查询所有类型
	$(function(){
		layui.use(['form','element','jquery','layer','laydate'], function(){
			var $=layui.jquery,form=layui.form,laydate = layui.laydate;
		
		$.ajax({
			type:"POST",
			dataType:"json",
			url:"../informationAction!selectType",
			async:false,
			success:function(msg){
				$(msg).each(function(index){
					$("#selSex").append("<option class='xwlx' value='"+msg[index].itiid+"'>"+msg[index].ititype+"</option>");
					form.render('select');
				});
				
			}
		});
		
	});
		$("span[name='qrtj']").bind('click',function(){
			var centerName=$("input[name='centerName']").val();
			var centerType=$(".xwlx:checked").val();
			var centerText=$("textarea[name='centerText']").val();
			var centerTime=$("input[name='centerTime']").val();
			$.ajax({
				type:"POST",
				dataType:"json",
				data:{"centerName":centerName,"centerType":centerType," centerText": centerText,"centerTime":centerTime},
				url:"../informationAction!addCenter",
				async:false,
				success:function(msg){
					layer.alert('数据添加成功！', {icon: 1});
				//自动点击重置按钮
				$("button[name='cz']").click(); 
				}
			});
		});
	});
	</script>
	<script type="text/javascript">
	layui.use('form',function(){
	});
	</script>
	<script>
	laydate.render({
	 elem: '#test1'
	});
	</script>
</body>
</html>